hello again
let's say we have an array of chars, and we want to find the memory adress of '\0' character, also we want to print it.
this is what i did
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(void) {
char s1[] = "name";
int i;
char *p;
p = &s1;
for (i=0;i<=strlen(s1);i++){
if (*(p + i) != '\0') {
printf("not yet\n");
}
else if (*(p + i) == '\0')
{
printf("found \0 character\n");
printf("memory adress: %d\n",p+i);
printf("character: %c\n",*(p+i));
}
}
system("PAUSE");
return 0;
}
my problem is that i get a warning, for line 11 which is this line
Code:
11 C:\..\test.c [Warning] assignment from incompatible pointer type
i think it works fine, but why am i getting this warning?
thanks in advance